home *** CD-ROM | disk | FTP | other *** search
/ Aminet 28 / Aminet 28 (1998)(GTI - Schatztruhe)[!][Dec 1998].iso / Aminet / dev / misc / gms_dev.lha / GMSDev / Includes / graphics / blitter.i < prev    next >
Encoding:
Text File  |  1998-09-05  |  13.0 KB  |  366 lines

  1.     IFND GRAPHICS_BLITTER_I
  2. GRAPHICS_BLITTER_I SET  1
  3.  
  4. **
  5. **  $VER: blitter.i
  6. **
  7. **  Blitter Module Definitions
  8. **
  9. **  (C) Copyright 1996-1998 DreamWorld Productions.
  10. **      All Rights Reserved.
  11. **
  12.  
  13.     IFND    DPKERNEL_I
  14.     include 'dpkernel/dpkernel.i'
  15.     ENDC
  16.  
  17. *****************************************************************************
  18. * Module definitions.
  19.  
  20. BlitModVersion  = 3
  21. BlitModRevision = 1
  22.  
  23. *****************************************************************************
  24. * Pixel definitions.
  25.  
  26.    STRUCTURE    PXL,00
  27.     WORD    PXL_XCoord
  28.     WORD    PXL_YCoord
  29.     LONG    PXL_Colour
  30.     LABEL    PXL_SIZEOF
  31.  
  32. PIXEL    MACRO
  33.     dc.w    \1,\2
  34.     dc.l    \3
  35.     ENDM
  36.  
  37. SKIPPIXEL =    -32000
  38.  
  39. *****************************************************************************
  40. * Bitmap structure, used for blitting.
  41.  
  42. VER_BITMAP  = 2
  43. TAGS_BITMAP = (ID_SPCTAGS<<16)|ID_BITMAP
  44.  
  45.    STRUCTURE    BMP1,HEAD_SIZEOF ;[00] Standard header.
  46.     APTR    BMP_Data         ;[12] Pointer to bitmap data area.
  47.     WORD    BMP_Width        ;[16] Width.
  48.     WORD    BMP_ByteWidth    ;[18] ByteWidth.
  49.     WORD    BMP_Height       ;[20] Height.
  50.     WORD    BMP_Type         ;[22] Type.
  51.     LONG    BMP_LineMod      ;[24] Line differential.
  52.     LONG    BMP_PlaneMod     ;[28] Plane differential.
  53.     APTR    BMP_Parent       ;[32] Bitmap owner.
  54.     APTR    BMP_Restore      ;[36] Restore list for this bitmap, if any.
  55.     LONG    BMP_Size         ;[40] Total size of the bitmap in bytes.
  56.     LONG    BMP_MemType      ;[44] Memory type to use in allocation.
  57.     WORD    BMP_Planes       ;[48] Amount of planes.
  58.     WORD    BMP_resEmpty     ;[50] Reserved.
  59.     LONG    BMP_AmtColours   ;[52] Maximum amount of colours available.
  60.     APTR    BMP_Palette      ;[56] Pointer to the Bitmap's palette.
  61.     LONG    BMP_Flags        ;[60] Optional flags.
  62.     APTR    BMP_DrawUCPixel  ;[64] Function.
  63.     APTR    BMP_DrawUCRPixel ;[68] Function.
  64.     APTR    BMP_ReadUCPixel  ;[72] Function.
  65.     APTR    BMP_ReadUCRPixel ;[76] Function.
  66.     APTR    BMP_DrawPen      ;[80] Function.
  67.     APTR    BMP_PenUCPixel   ;[84] Function.
  68.  
  69. BMA_Data         = (TAPTR|BMP_Data)
  70. BMA_Width        = (TWORD|BMP_Width)
  71. BMA_Height       = (TWORD|BMP_Height)
  72. BMA_Type         = (TWORD|BMP_Type)
  73. BMA_Size         = (TLONG|BMP_Size)
  74. BMA_MemType      = (TLONG|BMP_MemType)
  75. BMA_Planes       = (TWORD|BMP_Planes)
  76. BMA_AmtColours   = (TLONG|BMP_AmtColours)
  77. BMA_Palette      = (TAPTR|BMP_Palette)
  78. BMA_Flags        = (TLONG|BMP_Flags)
  79. BMA_DrawUCPixel  = (TAPTR|BMP_DrawUCPixel)
  80. BMA_DrawUCRPixel = (TAPTR|BMP_DrawUCRPixel)
  81. BMA_ReadUCPixel  = (TAPTR|BMP_ReadUCPixel)
  82. BMA_ReadUCRPixel = (TAPTR|BMP_ReadUCRPixel)
  83. BMA_DrawPen      = (TAPTR|BMP_DrawPen)
  84. BMA_PenUCPixel   = (TAPTR|BMP_PenUCPixel)
  85.  
  86. *****************************************************************************
  87. * Bitmap types (for BMP_Type).
  88.  
  89. INTERLEAVED = 1           ;Interleaved (2 ... 256 colours)
  90. ILBM        = INTERLEAVED ;Short synonym of Interleaved.
  91. PLANAR      = 2           ;Planar (2 ... 256 colours)
  92. CHUNKY8     = 3           ;Chunky 8 bit (256 colours)
  93. CHUNKY16    = 4           ;Chunky 16 bit (65535 colours)
  94. CHUNKY32    = 5           ;True colour (16 million colours)
  95.  
  96. TRUECOLOUR  = CHUNKY32
  97.  
  98. *****************************************************************************
  99. * Bitmap flags (for BMP_Flags).
  100.  
  101. BMF_BLANKPALETTE = $00000001  ;For a blank (black) palette.
  102. BMF_EXTRAHB      = $00000002  ;Extra half brite.
  103. BMF_HAM          = $00000004  ;HAM mode.
  104.  
  105. *****************************************************************************
  106. * Pen shapes.
  107.  
  108. PSP_CIRCLE  = 1
  109. PSP_SQUARE  = 2
  110. PSP_PIXEL   = 3
  111.  
  112. *****************************************************************************
  113.  
  114. PALETTE_ARRAY = ((ID_PALETTE<<16)|01)
  115.  
  116. *****************************************************************************
  117. * The RestoreList structure.
  118.  
  119. VER_RESTORE  = 1
  120. TAGS_RESTORE = (ID_SPCTAGS<<16)|ID_RESTORE
  121.  
  122.     STRUCTURE    RH1,HEAD_SIZEOF
  123.     WORD    RH_Buffers       ;Amount of screen buffers
  124.     WORD    RH_Entries       ;Amount of entries.
  125.     APTR    RH_Owner         ;Owner of the restorelist, ie bitmap.
  126.  
  127.     *** Private fields below ***
  128.  
  129.     APTR    RH_List1
  130.     APTR    RH_List2
  131.     APTR    RH_List3
  132.     APTR    RH_ListPos1
  133.     APTR    RH_ListPos2
  134.     APTR    RH_ListPos3
  135.     LABEL    RH_SIZEOF
  136.  
  137. RSA_Buffers = (TWORD|RH_Buffers)
  138. RSA_Entries = (TWORD|RH_Entries)
  139. RSA_Owner   = (TAPTR|RH_Owner)
  140.  
  141.     *** Private Structure ***
  142.  
  143.     STRUCTURE    RSE,0
  144.     APTR    RSE_Next         ;Next restore entry in the chain.
  145.     APTR    RSE_Prev         ;Previous restore enty in the chain.
  146.     APTR    RSE_Bob          ;Bob structure belonging to the restore [*]
  147.     APTR    RSE_Address      ;Screen pointer (top of screen) [*]
  148.     LABEL    RSE_Mask         ;Pointer to the bob's mask [Label *]
  149.     APTR    RSE_Storage      ;Background storage or NULL.
  150.     APTR    RSE_Control      ;Controls from the lookup table.
  151.     APTR    RSE_ConMask      ;The control mask to use.
  152.     WORD    RSE_Modulo1      ;Modulo C
  153.     LONG    RSE_Modulo2      ;Modulos A/D.
  154.     LABEL    RSE_BlitSize     ;[Label *]
  155.     WORD    RSE_BlitWidth    ;[*]
  156.     WORD    RSE_BlitHeight   ;[*]
  157.     LABEL    RSE_SIZEOF
  158.  
  159. *****************************************************************************
  160. * Bob structure, also used as a skeleton for Mbob's.
  161.  
  162. VER_BOB  =  1
  163. TAGS_BOB =  (ID_SPCTAGS<<16)|ID_BOB
  164.  
  165.     STRUCTURE    BOB1,HEAD_SIZEOF
  166.     APTR    BOB_emp1           ;...
  167.     APTR    BOB_emp2           ;...
  168.     APTR    BOB_GfxCoords      ;Pointer to frame list for graphics [R:W]
  169.     WORD    BOB_Frame          ;Current frame [R:W]
  170.     WORD    BOB_emp3           ;...
  171.     WORD    BOB_Width          ;Width in pixels (true width) [R:I]
  172.     WORD    BOB_ByteWidth      ;Width in bytes (round up) [R]
  173.     WORD    BOB_XCoord         ;X coordinate [R:W]
  174.     WORD    BOB_YCoord         ;Y coordinate [R:W]
  175.     WORD    BOB_Height         ;Height in pixels [R:I]
  176.     WORD    BOB_ClipLX         ;Left X border in bytes.
  177.     WORD    BOB_ClipTY         ;Top Y border.
  178.     WORD    BOB_ClipRX         ;Right X border in bytes.
  179.     WORD    BOB_ClipBY         ;Bottom Y border.
  180.     WORD    BOB_FPlane         ;First plane to blit to (planar only) [R:I]
  181.     WORD    BOB_Planes         ;Amount of planes [R:I]
  182.     WORD    BOB_PropHeight     ;Expected height of source bitmap.
  183.     WORD    BOB_PropWidth      ;Expected width of source bitmap.
  184.     WORD    BOB_Buffers        ;Amount of buffers in dest screen [O:R]
  185.     LONG    BOB_PlaneSize      ;Size of a single plane (planar only) [R]
  186.     LONG    BOB_Attrib         ;Attributes like CLIP and MASK.
  187.     APTR    BOB_SrcBitmap      ;Source Bitmap.
  188.     WORD    BOB_Empty          ;Reserved (in use by MBob).
  189.     WORD    BOB_emp4           ;...
  190.     APTR    BOB_Source         ;Pointer to bob source (origin).
  191.     APTR    BOB_DirectGfx      ;Pointer to direct frame list [R]
  192.     APTR    BOB_DestBitmap     ;Destination Bitmap [R]
  193.     APTR    BOB_MaskCoords     ;Pointer to frame list for masks [R:I]
  194.     APTR    BOB_DirectMasks    ;Pointer to direct frame list [R]
  195.     APTR    BOB_MaskBitmap     ;Source Bitmap for masks.
  196.     WORD    BOB_AmtFrames      ;Total amount of frames in GfxCoords.
  197.  
  198.     *** Private fields start now ***
  199.  
  200.     WORD    BOB_StoreSize      ;4/8/12 Sizeof one store entry (MBob's)
  201.     APTR    BOB_StoreBuffer    ;A/B/C [0/4/8] storage pointer (MBob's)
  202.     WORD    BOB_StoreMax       ;Maximum store position.
  203.     APTR    BOB_StoreMemory    ;Master storage pointer (for the freemem).
  204.     WORD    BOB_StoreCount     ;Counter for store, 0, 4, 8.
  205.     APTR    BOB_StoreA         ;Storage buffer 1.
  206.     APTR    BOB_StoreB         ;Storage buffer 2.
  207.     APTR    BOB_StoreC         ;Storage buffer 3.
  208.     APTR    BOB_DrawRoutine    ;Routine for drawing/clearing/storing.
  209.     APTR    BOB_ClearRoutine   ;Routine for clearing.
  210.     APTR    BOB_RestoreRoutine ;Routine for restoring/clearing.
  211.     APTR    BOB_HeightRoutine  ;Replaces BS_DrawRoutine for large heights.
  212.     LONG    BOB_ScreenSize     ;Size of destination plane.
  213.     WORD    BOB_Modulo         ;Bob Modulo (PicWidth-BobWidth)
  214.     WORD    BOB_MaskModulo     ;Mask Modulo (BobWidth-BobWidth for GENMASK).
  215.     APTR    BOB_MaskMemory     ;Master mask pointer (for the freemem).
  216.     WORD    BOB_MaxHeight      ;Maximum possible height, limited by blitter.
  217.     WORD    BOB_ScrLine        ;Size of a line (for interleaved).
  218.     WORD    BOB_BobLine        ;Size of a Bob line (Width*Planes)
  219.     WORD    BOB_MaskLine       ;Size of a Mask Line (Width*Planes)
  220.     WORD    BOB_TrueWidth      ;The true pixel width (++shift)
  221.     WORD    BOB_TrueBWidth     ;The true byte width (++shift)
  222.     WORD    BOB_TrueWWidth     ;The true word width (++shift)
  223.     WORD    BOB_ClipBLX        ;ClipLX, byte.
  224.     WORD    BOB_ClipBRX        ;ClipRX, byte.
  225.     LONG    BOB_Modulo1        ;Modulus. (C/B)
  226.     LONG    BOB_Modulo2        ;Modulus. (A/D)
  227.     LONG    BOB_NSModulo1      ;Modulus. (C/B)
  228.     LONG    BOB_NSModulo2      ;Modulus. (A/D)
  229.     WORD    BOB_WordWidth      ;The word width.
  230.     BYTE    BOB_AFlags         ;Allocation flags.
  231.     BYTE    BOB_Pad            ;
  232.     APTR    BOB_Screen         ;
  233.     APTR    BOB_MaskData       ;
  234.     WORD    BOB_SrcWidth       ;Source Page Width in bytes.
  235.     WORD    BOB_SrcMaskWidth   ;Mask Page Width in bytes.
  236.  
  237. BBA_Frame        = (TWORD|BOB_Frame)
  238. BBA_GfxCoords    = (TAPTR|BOB_GfxCoords)
  239. BBA_Width        = (TWORD|BOB_Width)
  240. BBA_Height       = (TWORD|BOB_Height)
  241. BBA_XCoord       = (TWORD|BOB_XCoord)
  242. BBA_YCoord       = (TWORD|BOB_YCoord)
  243. BBA_ClipLX       = (TWORD|BOB_ClipLX)
  244. BBA_ClipTY       = (TWORD|BOB_ClipTY)
  245. BBA_ClipRX       = (TWORD|BOB_ClipRX)
  246. BBA_ClipBY       = (TWORD|BOB_ClipBY)
  247. BBA_FPlane       = (TWORD|BOB_FPlane)
  248. BBA_Planes       = (TWORD|BOB_Planes)
  249. BBA_PropHeight   = (TWORD|BOB_PropHeight)
  250. BBA_PropWidth    = (TWORD|BOB_PropWidth)
  251. BBA_Buffers      = (TWORD|BOB_Buffers)
  252. BBA_Attrib       = (TLONG|BOB_Attrib)
  253. BBA_SrcBitmap    = (TAPTR|BOB_SrcBitmap)
  254. BBA_Source       = (TAPTR|BOB_Source)
  255. BBA_MaskCoords   = (TAPTR|BOB_MaskCoords)
  256. BBA_MaskBitmap   = (TAPTR|BOB_MaskBitmap)
  257.  
  258. BBA_SourceTags   = (TSTEPIN|TTRIGGER|BOB_Source)
  259. BBA_AmtPlanes    = BBA_Planes
  260.  
  261. *****************************************************************************
  262. * MBob structure for MBV1, based on BBV1.
  263.  
  264. VER_MBOB  =  1
  265. TAGS_MBOB =  (ID_SPCTAGS<<16)|ID_MBOB
  266.  
  267.     STRUCTURE    MBOB1,HEAD_SIZEOF
  268.     APTR    MB_emp1           ;...
  269.     APTR    MB_emp2           ;...
  270.     APTR    MB_GfxCoords      ;Pointer to frame list for graphics.
  271.     WORD    MB_AmtEntries     ;Amount of entries in the image list.
  272.     WORD    MB_emp3           ;...
  273.     WORD    MB_Width          ;Width in pixels.
  274.     WORD    MB_ByteWidth      ;Width in bytes.
  275.     APTR    MB_EntryList      ;Pointer to the entry/image list.
  276.     WORD    MB_Height         ;Height in pixels.
  277.     WORD    MB_ClipLX         ;Left X border in bytes.
  278.     WORD    MB_ClipTY         ;Top Y border.
  279.     WORD    MB_ClipRX         ;Right X border in bytes.
  280.     WORD    MB_ClipBY         ;Bottom Y border.
  281.     WORD    MB_FPlane         ;First plane to blit to (planar only)
  282.     WORD    MB_Planes         ;Amount of planes.
  283.     WORD    MB_PropHeight     ;Expected height of source picture.
  284.     WORD    MB_PropWidth      ;Expected width of source picture.
  285.     WORD    MB_Buffers        ;Amount of buffers in dest screen.
  286.     LONG    MB_PlaneSize      ;Size Of Plane Source (planar only)
  287.     LONG    MB_Attrib         ;Attributes like CLIP and MASK.
  288.     APTR    MB_SrcBitmap      ;Source Bitmap.
  289.     WORD    MB_EntrySize      ;Size of each entry.
  290.     WORD    MB_emp4           ;...
  291.     APTR    MB_Source         ;Pointer to source structure (bob origin).
  292.     APTR    MB_DirectGfx      ;Pointer to direct frame list.
  293.     APTR    MB_DestBitmap     ;Pointer to Bob's destination Bitmap.
  294.     APTR    MB_MaskCoords     ;Pointer to frame list for masks.
  295.     APTR    MB_DirectMasks    ;
  296.     APTR    MB_MaskBitmap     ;
  297.     WORD    MB_AmtFrames      ;Total amount of frames in frame/direct lists.
  298.  
  299.    STRUCTURE    BE,0              ;MBob Entry Structure.
  300.     WORD    BE_XCoord
  301.     WORD    BE_YCoord
  302.     UWORD    BE_Frame
  303.     LABEL    BE_SIZEOF
  304.  
  305. SKIPIMAGE =  32000
  306.  
  307. MBA_AmtEntries   = (TWORD|MB_AmtEntries)
  308. MBA_GfxCoords    = (TAPTR|MB_GfxCoords)
  309. MBA_Width        = (TWORD|MB_Width)
  310. MBA_Height       = (TWORD|MB_Height)
  311. MBA_EntryList    = (TAPTR|MB_EntryList)
  312. MBA_ClipLX       = (TWORD|MB_ClipLX)
  313. MBA_ClipTY       = (TWORD|MB_ClipTY)
  314. MBA_ClipRX       = (TWORD|MB_ClipRX)
  315. MBA_ClipBY       = (TWORD|MB_ClipBY)
  316. MBA_FPlane       = (TWORD|MB_FPlane)
  317. MBA_Planes       = (TWORD|MB_Planes)
  318. MBA_Attrib       = (TLONG|MB_Attrib)
  319. MBA_SrcBitmap    = (TAPTR|MB_SrcBitmap)
  320. MBA_EntrySize    = (TWORD|MB_EntrySize)
  321. MBA_Source       = (TAPTR|MB_Source)
  322. MBA_Buffers      = (TWORD|MB_Buffers)
  323. MBA_MaskCoords   = (TAPTR|MB_MaskCoords)
  324. MBA_PropWidth    = (TWORD|MB_PropWidth)
  325. MBA_PropHeight   = (TWORD|MB_PropHeight)
  326. MBA_MaskBitmap   = (TAPTR|MB_MaskBitmap)
  327.  
  328. *****************************************************************************
  329. * Drawing Methods and Options for both bob structures (BOB_Attrib).
  330.  
  331. B_CLIP     =     0       ;Allow border clipping.
  332. B_MASK     =     1       ;Allow masking.
  333. B_FILLMASK =    2       ;Fill any holes in the mask on generation.
  334. B_CLEAR    =    3       ;Allow automatic clearing.
  335. B_RESTORE  =    4       ;Allow automatic background restore.
  336. ;B_ = 5
  337. B_CLRMASK  =    6       ;Use masks in the clear.
  338. B_GENONLY  =    7       ;Create and use masks for drawing this bob.
  339.  
  340. BBF_CLIP     =  (1<<B_CLIP)
  341. BBF_MASK     =  (1<<B_MASK)
  342. BBF_FILLMASK =  (1<<B_FILLMASK)
  343. BBF_CLEAR    =  (1<<B_CLEAR)
  344. BBF_RESTORE  =  (1<<B_RESTORE)
  345. ; = 1<<
  346. BBF_CLRMASK  =  (1<<B_CLRMASK)
  347. BBF_GENONLY  =  (1<<B_GENONLY)
  348. BBF_GENMASKS =  (BBF_GENONLY|BBF_MASK)
  349.  
  350. BBF_CLRNOMASK = 0                ;Do not use masks in the clear (default).
  351. BBF_GENMASK   = BBF_GENMASKS     ;Synonym.
  352. BBF_FILLMASKS = BBF_FILLMASK     ;Synonym.
  353. BBF_GENFMASK  = (BBF_GENMASK|BBF_FILLMASK)
  354.  
  355. *****************************************************************************
  356.  
  357. BSORT_X         = $00000001
  358. BSORT_Y         = $00000002
  359. BSORT_DOWNTOP   = $00000004    ;From Bottom to top.
  360. BSORT_RIGHTLEFT = $00000008    ;Right to Left.
  361. BSORT_LEFTRIGHT = $00000000    ;Default.
  362. BSORT_TOPDOWN   = $00000000    ;Default.
  363.  
  364.  
  365.     ENDC    ;GRAPHICS_BLITTER_I
  366.